def is_correct_brackets(queen):
    while '()' in queen or '[]' in queen or '{}' in queen:
        queen = queen.replace('()', '')
        queen = queen.replace('[]', '')
        queen = queen.replace('{}', '')
        return not queen
    
a = input()
print(is_correct_brackets)
